package com.mapbar.ure.backend;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * DFA内部节点实现
 * 
 * @author QIN Jian
 * 
 * @param <T>
 */
public class DFANode<T> {
	private Map<T, DFANode<T>> next = new HashMap<T, DFANode<T>>();
	private boolean isEndState;

	public boolean isEndState() {
		return isEndState;
	}

	public void setEndState(boolean isEndState) {
		this.isEndState = isEndState;
	}

	public Map<T, DFANode<T>> getNext() {
		return next;
	}

	public void setNext(Map<T, DFANode<T>> next) {
		this.next = next;
	}

	public void print(ArrayList<DFANode<T>> all) {
		if (isEndState) {
			System.out.println("\tEND");
		}
		for (T c : next.keySet()) {
			System.out.print(c);
			System.out.print('\t');
			System.out.print("==>");
			System.out.print('\t');
			System.out.println(all.indexOf(next.get(c)));
		}
	}

}
